package cate.game.activity.customwarorder;

import cate.common.table.activity.customwarorder.row.CustomWarorderBaseRow;
import cate.common.table.d.GDWarOrder;
import cate.game.activity.base.core.SubActivitySingle;
import cate.game.role.task.TaskGroup;
import easy.java.dev.note.NoteClass;

import java.util.List;

@NoteClass("战令任务数据")
public class RoleCustomWarOrderTask extends SubActivitySingle<RoleCustomWarOrder> {

	@Override
	public void onEnter() {

	}

	public void excelCheck() {
		List<Integer> taskIds = role.getGame().table.customWarorder.task.getTaskIds(configGroup());
		role.getTask().getGroup(parent.funcId()).addItemListNoRepeat(taskIds, false);
	}

	public void beforeOver() {

	}

	public void clear() {
		parent.getRole().getTask().removeGroup(funcId());
	}

	public int configGroup() {
		CustomWarorderBaseRow baseRow = parent.getRow();
		if (baseRow == null) {
			return -1;
		} else {
			return baseRow.taskGroup;
		}
	}

	@Override
	public void onDaySpan(boolean silence) {
		List<Integer> taskIds = role.getGame().table.customWarorder.task.getTaskIds(configGroup(), GDWarOrder.TaskType.DAILY);
		TaskGroup taskGroup = role.getTask().getGroup(funcId());
		taskGroup.removeItemList(taskIds);
		taskGroup.addItemListNoRepeat(taskIds, silence);
	}

	@Override
	public void onWeekSpan(boolean silence) {
		List<Integer> taskIds = role.getGame().table.customWarorder.task.getTaskIds(configGroup(), GDWarOrder.TaskType.WEEKLY);
		TaskGroup taskGroup = role.getTask().getGroup(funcId());
		taskGroup.removeItemList(taskIds);
		taskGroup.addItemListNoRepeat(taskIds, silence);
	}
}
